<?php 
/**
 * 用户凭证
 */
class Certificate{
	/**
	 * @var string Identity
	 */
	public $Id;

	/**
	 * @var string Unique
	 */
	public $Name;

	/**
	 * @var string
	 */
	public $Password;

	/**
	 * @var int
	 */
	public $Permissions;

	/**
	 * @var datetime 建立日期
	 */
	public $CreateDate;

	/**
	 * @var datetime 修改日期
	 */
	public $ModifyDate;

	/**
	 * @var int
	 */
	public $Status;

	public function __construct(){
		$var=get_class_vars(__CLASS__);
		foreach(func_get_args() as $o){
			if(is_array($o)){
				foreach($o as $k => $v){
					if($k=='Id'){
						$this->Id=$v;
					}
					else if($k=='Name'){
						$this->Name=$v;
					}
					else if($k=='Password'){
						$this->Password=$v;
					}
					else if($k=='Permissions'){
						$this->Permissions=intval($v);
					}
					else if($k=='CreateDate'){
						$this->CreateDate=intval($v);
					}
					else if($k=='ModifyDate'){
						$this->ModifyDate=intval($v);
					}
					else if($k=='Status'){
						$this->Status=intval($v);
					}
				}
			}else if(is_object($o)){
				foreach($var as $k => $v){
					if(isset($o->Id)){
						$this->Id=$o->Id;
					}
					if(isset($o->Name)){
						$this->Name=$o->Name;
					}
					if(isset($o->Password)){
						$this->Password=$o->Password;
					}
					if(isset($o->Permissions)){
						$this->Permissions=$o->Permissions;
					}
					if(isset($o->CreateDate)){
						$this->CreateDate=$o->CreateDate;
					}
					if(isset($o->ModifyDate)){
						$this->ModifyDate=$o->ModifyDate;
					}
					if(isset($o->Status)){
						$this->Status=$o->Status;
					}
				}
			}
		}
	}

	public function __modetoarray(){
		$var=array();
		foreach(get_class_vars(__CLASS__) as $k => $v){
			$var[$k]=$this->$k;
		}
		return $var;
	}
}


?>